package net.didactylos.helpline.action;

import java.util.List;

import org.hibernate.Session;

import net.didactylos.helpline.stripes.bean.HelplineActionBean;
import net.didactylos.helpline.stripes.security.*;
import net.sourceforge.stripes.action.*;
import net.didactylos.helpline.data.Message;

public class FindConversationAction extends HelplineActionBean
{

	private List<Message> messages;
	
	@SuppressWarnings("unchecked")
	public List<Message> getMessages()
	{
		if (messages == null)
		{
			Session session = getContext().getSession();
			messages = session.createCriteria(Message.class).list();
		}
		return messages;
	}

	@DontValidate
	@DefaultHandler
	@Secured(Capabilities.SIGN_IN)
	public Resolution view()
	{
		return new ForwardResolution("findConversation.jspx");
	}
}
